#include "stdafx.h"
#include "CLuces.h"

CLuces::CLuces()
{
}
CLuces::~CLuces()
{
}

void CLuces::ambiente(float x, float y, float z, float r)
{
	ambient[0] = x;
	ambient[1] = y;
	ambient[2] = z;
	ambient[3] = r;
}

void CLuces::difusa(float x, float y, float z, float r)
{
	diffuse[0] = x;
	diffuse[1] = y;
	diffuse[2] = z;
	diffuse[3] = r;
}

void CLuces::posicional(float x, float y, float z, float r)
{
	position[0] = x;
	position[1] = y;
	position[2] = z;
	position[3] = r;
}

void CLuces::luz_mod_amb(float x, float y, float z, float r)
{
	lmodel_ambient[0] = x;
	lmodel_ambient[1] = y;
	lmodel_ambient[2] = z;
	lmodel_ambient[3] = r;
}

void CLuces::setLuces(int n)
{
	switch (n)
	{
		case 0: glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
				glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
				glLightfv(GL_LIGHT0, GL_POSITION, position);
				glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
				glEnable(GL_LIGHT0);
		break;

		case 1: glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
				glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
				glLightfv(GL_LIGHT1, GL_POSITION, position);
				glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
				glEnable(GL_LIGHT1);
		break;

		case 2: glLightfv(GL_LIGHT2, GL_AMBIENT, ambient);
				glLightfv(GL_LIGHT2, GL_DIFFUSE, diffuse);
				glLightfv(GL_LIGHT2, GL_POSITION, position);
				glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
				glEnable(GL_LIGHT2);
		break;
		
		case 3: glLightfv(GL_LIGHT3, GL_AMBIENT, ambient);
				glLightfv(GL_LIGHT3, GL_DIFFUSE, diffuse);
				glLightfv(GL_LIGHT3, GL_POSITION, position);
				glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
				glEnable(GL_LIGHT3);
		break;
	}	
}